package net.xo68.destiny.manager.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import net.xo68.destiny.manager.entity.NodeMonitor;
import net.xo68.destiny.manager.mapper.NodeMonitorMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;



/** 
 * NodeMonitor Service
 * @author wuxie(16349023@qq.com)
 * @date 2020年12月14日 11:10:13
 *
 */
@Slf4j
@Service
public class NodeMonitorService{
    
    @Autowired
    private NodeMonitorMapper nodeMonitorMapper;

    public NodeMonitor find(Long id) {
        return  nodeMonitorMapper.find(id);
    }

    public NodeMonitor insert(NodeMonitor nodeMonitor) {
        nodeMonitorMapper.insert(nodeMonitor);
        return nodeMonitor;
    }

    public NodeMonitor update(NodeMonitor nodeMonitor) {
        nodeMonitorMapper.update(nodeMonitor);
        return nodeMonitor;
    }
    
    public int delete(Long id) {
        return nodeMonitorMapper.delete(id);
    }
    
    public List<NodeMonitor> list() {
        return nodeMonitorMapper.list();
    }
	
	public PageInfo<NodeMonitor> list(int pageNumber,int pageSize) {
        PageHelper.startPage(pageNumber, pageSize,true);
        List<NodeMonitor> docs = nodeMonitorMapper.list();
        PageInfo<NodeMonitor> pageInfo = new PageInfo<NodeMonitor>(docs);
        return pageInfo;
    }

    public int removeExpired(long timeoutSecond){
        return nodeMonitorMapper.removeExpired(timeoutSecond);
    }
}